function bins = graydecode(grays)
bins = zeros( size(grays) );
for i = 1 : size(grays, 2)
    while grays(i)
        bins(i)  = bitxor(bins(i), grays(i));
        grays(i) = bitshift(grays(i), -1);
    end
end
end